/*
 * Droplet.cpp
 *
 * Created: 5/11/2012 4:13:57 PM
 *  Author: common
 */ 

#include <avr/io.h>
#include <math.h>
#include <util/delay.h>

#include "motor.h"
#include "RGB_LED.h"

int main(void)
{
//	motor_init();
		
//	move(NORTHWEST, 125);		

	PORTD.DIRSET = PIN4_bm;
	PORTE.DIRSET = PIN4_bm | PIN5_bm;
	
	PORTC.DIRSET = PIN0_bm | PIN1_bm | PIN4_bm | PIN5_bm;
	PORTE.DIRSET = PIN0_bm | PIN1_bm | PIN4_bm | PIN5_bm;
	
	//PORTD.OUTSET = PIN4_bm;
	
	init_RGB_LED();
	//motor_init();
	
    while(1)
    {
		uint8_t red = 0;
		uint8_t green = 0;
		uint8_t blue= 0;
		
		
		//for (blue = 0; blue < 255; blue+=10)
			//for (green = 0; green < 255; green+=10)
				//for (red = 0; red < 255; red+=10)
				//{
					//set_red(red);
					//set_green(green);
					//set_blue(blue);
					//_delay_ms(10);
				//}					
//
		//move(NORTH, 96);
		
		for (red=0, green=0, blue = 0; blue < 255; blue+=5)
		{
			set_red(red);
			set_green(green);
			set_blue(blue);
			_delay_ms(100);
		}		
		
		//move(NORTH, 0);
		
		for (red=0, green=0, blue = 0; red < 255; red+=5)
		{
			set_red(red);
			set_green(green);
			set_blue(blue);
			_delay_ms(100);
		}		
		
		for (red=0, green=0, blue = 0; green < 255; green+=5)
		{
			set_red(red);
			set_green(green);
			set_blue(blue);
			_delay_ms(100);
		}		
		
		
		
		//set_red(255);
		//_delay_ms(3000);
		//set_blue(255);
		//_delay_ms(3000);
		//set_green(255);
		//_delay_ms(3000);
   //
   
   
    }
}